Skip to content

Conversation

mtrofin
Copy link
Member

@mtrofin mtrofin commented Oct 13, 2025

No description provided.

Copy link
Member Author

mtrofin commented Oct 13, 2025

@mtrofin mtrofin force-pushed the users/mtrofin/10-10-_slp_ branch from 6c3e7ae to 416d1f0 Compare October 13, 2025 02:17
@mtrofin mtrofin force-pushed the users/mtrofin/10-12-_nfc_instcombine_use_the_builder_s_createselectwithunknownprofile_ branch from 8464527 to 0e385b4 Compare October 13, 2025 02:17
@mtrofin mtrofin marked this pull request as ready for review October 13, 2025 02:18
@mtrofin mtrofin requested a review from nikic as a code owner October 13, 2025 02:18
@llvmbot llvmbot added llvm:instcombine Covers the InstCombine, InstSimplify and AggressiveInstCombine passes llvm:transforms labels Oct 13, 2025
@llvmbot
Copy link
Member

llvmbot commented Oct 13, 2025

@llvm/pr-subscribers-llvm-transforms

Author: Mircea Trofin (mtrofin)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/163116.diff

2 Files Affected:

  • (modified) llvm/lib/Transforms/InstCombine/InstCombineInternal.h (+1-1)
  • (modified) llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp (+2-2)
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineInternal.h b/llvm/lib/Transforms/InstCombine/InstCombineInternal.h
index 70718766e8ec5..943c223e516fb 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineInternal.h
+++ b/llvm/lib/Transforms/InstCombine/InstCombineInternal.h
@@ -471,7 +471,6 @@ class LLVM_LIBRARY_VISIBILITY InstCombinerImpl final
   Value *simplifyNonNullOperand(Value *V, bool HasDereferenceable,
                                 unsigned Depth = 0);
 
-public:
   /// Create `select C, S1, S2`. Use only when the profile cannot be calculated
   /// from existing profile metadata: if the Function has profiles, this will
   /// set the profile of this select to "unknown".
@@ -484,6 +483,7 @@ class LLVM_LIBRARY_VISIBILITY InstCombinerImpl final
     return Sel;
   }
 
+public:
   /// Create and insert the idiom we use to indicate a block is unreachable
   /// without having to rewrite the CFG from within InstCombine.
   void CreateNonTerminatorUnreachable(Instruction *InsertAt) {
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
index 63e24a0e90853..a330bb7b2fc30 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
@@ -110,8 +110,8 @@ static Value *simplifyShiftSelectingPackedElement(Instruction *I,
                               ShrAmt->getName() + ".z");
   // There is no existing !prof metadata we can derive the !prof metadata for
   // this select.
-  Value *Select = IC.createSelectInstWithUnknownProfile(ShrAmtZ, Lower, Upper);
-  IC.Builder.Insert(Select);
+  Value *Select = IC.Builder.CreateSelectWithUnknownProfile(ShrAmtZ, Lower,
+                                                            Upper, DEBUG_TYPE);
   Select->takeName(I);
   return Select;
 }

Copy link
Contributor

@nikic nikic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Base automatically changed from users/mtrofin/10-10-_slp_ to main October 13, 2025 16:06
@mtrofin mtrofin force-pushed the users/mtrofin/10-12-_nfc_instcombine_use_the_builder_s_createselectwithunknownprofile_ branch from 0e385b4 to 510bad8 Compare October 13, 2025 16:09
Copy link
Member Author

mtrofin commented Oct 13, 2025

Merge activity

  • Oct 13, 5:01 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Oct 13, 5:03 PM UTC: @mtrofin merged this pull request with Graphite.

@mtrofin mtrofin merged commit ad69fef into main Oct 13, 2025
10 checks passed
@mtrofin mtrofin deleted the users/mtrofin/10-12-_nfc_instcombine_use_the_builder_s_createselectwithunknownprofile_ branch October 13, 2025 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

llvm:instcombine Covers the InstCombine, InstSimplify and AggressiveInstCombine passes llvm:transforms

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants